<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn" xml:lang="zh-cn">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="步骤1：开启数据库表所在目录的快照功能">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="hive_00011.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="">
<meta name="DC.Publisher" content="20250306">
<meta name="prodname" content="csbs">
<meta name="documenttype" content="usermanual">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="hive_00012">
<meta name="DC.Language" content="zh-cn">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>步骤1：开启数据库表所在目录的快照功能</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="hive_00012"></a><a name="hive_00012"></a>

<h1 class="topictitle1">步骤1：开启数据库表所在目录的快照功能</h1>
<div><p>执行保护前，需要先参考本节对要保护的Hive数据库表所在目录开启快照功能。</p>
<div class="section"><h4 class="sectiontitle">前提条件</h4><p>开启此功能前，请确保大数据集群的节点未进入安全模式。查询节点是否处于安全模式和退出安全模式的方法，请参考<a href="Hive_00075.html">退出集群安全模式</a>。</p>
</div>
<div class="section"><h4 class="sectiontitle">操作步骤</h4><ol><li><span>使用PuTTY，登录大数据集群中的任一NameNode节点。</span></li><li><span>根据集群认证模式，完成Hive客户端登录。以MRS产品为例，具体操作请参考对应版本的<a href="https://support.huawei.com/enterprise/zh/cloud-computing/mapreduce-service-pid-22396131" target="_blank" rel="noopener noreferrer">《MapReduce Service产品文档》</a>的“使用Hive客户端”章节。</span></li><li><span>执行以下命令，查询数据库表的父目录（库名和表名请以实际的替换）。</span><p><pre class="screen">SHOW CREATE TABLE <em>库名</em>.<em>表名</em>;</pre>
<p>以回显为“hdfs://hacluster/user/hive/warehouse/partion_test.db/OrderInfo”为例，“/user/hive/warehouse/partion_test.db”即为数据库表的父目录。</p>
</p></li><li><span>对于MRS产品，执行以下命令，退出beeline客户端。</span><p><pre class="screen">!q</pre>
</p></li><li><span>执行以下命令开启目录的快照功能。</span><p><pre class="screen">hdfs dfsadmin -allowSnapshot <em>directory_name</em></pre>
<p>其中，<em>directory_name</em>为要保护的数据库表的父目录。</p>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>父主题：</strong> <a href="hive_00011.html">备份Hive备份集</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">版权所有 &copy; 华为技术有限公司</div></body>
</html>